package com.javajun.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.javajun.custom.BaseService;
import com.javajun.entity.Enterprise;
import com.javajun.entity.Invoice;
import com.javajun.repository.InvoiceRepository;

@Service
public class InvoiceService extends BaseService<Invoice, Integer>{

    @Autowired
    private InvoiceRepository invoiceRepository;

    public Page<Invoice> findByEnterprise(Enterprise enterprise, Pageable pageable) {
        return invoiceRepository.findByEnterprise(enterprise, pageable);
    }

    public Invoice findByInvoiceCode(String invoiceCode) {
        return invoiceRepository.findByInvoiceCode(invoiceCode);
    }

    public Invoice findByInvoiceNum(String invoiceNum) {
        return invoiceRepository.findByInvoiceNum(invoiceNum);
    }
}
